<template>
  <div class="box">
    <van-nav-bar title="全部订单" left-text="返回" left-arrow @click-left="onClickLeft" />
    <van-tabs v-model:active="active">
      <van-tab v-for="item in TabTitle" :title="item"></van-tab>
    </van-tabs>
    <div v-if="active == 0">
      <All :order="allorder"></All>
    </div>
    <div v-if="active == 1">
      <obligation :order="noorder"></obligation>
    </div>
    <div v-if="active == 2">
      <shared></shared>
    </div>
    <div v-if="active == 3">
      <shipment :order="toorder"></shipment>
    </div>
    <div v-if="active == 4">
      <received></received>
    </div>
    <div v-if="active == 5">
      <evaluate></evaluate>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import axios from 'axios'
import { useRouter } from 'vue-router'
import All from '@/compentents/tabs/all.vue'
import evaluate from '@/compentents/tabs/evaluate.vue'
import obligation from '@/compentents/tabs/obligation.vue'
import received from '@/compentents/tabs/received.vue'
import shared from '@/compentents/tabs/shared.vue'
import shipment from '@/compentents/tabs/shipment.vue'
const onClickLeft = () => history.back()
var orderList = ref([])
const active = ref(0)
const TabTitle = ref(['全部', '待付款', '待分享', '待发货', '待收货', '评价'])
const noorder = ref([])
const toorder = ref([])
var allorder=ref([])
const oderAll = async () => {
  var res = await axios.get('/app/allprice')
  console.log(res.data.data)
  if (res.data.code == 200) {
    orderList.value = res.data.data
    noorder.value = orderList.value.filter((item: any) => {
      return item.status == '待支付'
    })
    console.log(noorder.value)
    toorder.value = orderList.value.filter((item: any) => {
      return item.status == '待发货'
    })
    console.log(toorder.value)
    allorder.value=[...noorder.value,...toorder.value]
  }
}
oderAll()
onMounted(() => {})
</script>
<style lang="scss">
.box {
  width: 100vw;
  height: 100vh;
  background-color: #f5f5f5;
}
</style>
